package com.yxhl.zoume.core.func.timepicker.presenter;

import android.content.Context;

import com.yxhl.zoume.common.presenter.BasePresenter;
import com.yxhl.zoume.common.ui.view.BaseView;
import com.yxhl.zoume.core.func.timepicker.ZMTimePicker;
import com.yxhl.zoume.core.func.timepicker.ZMTimePickerFactory;
import com.yxhl.zoume.core.func.timepicker.view.ZMTimePickerView;

import javax.inject.Inject;

/**
 * Created by sugarya on 16/8/13.
 */
public class ZMTimePickerPresenter extends BasePresenter {


    private static final String TAG = "ZMTimePickerPresenter";

    private ZMTimePickerView mZMTimePickerView;


    @Inject
    public ZMTimePickerPresenter(Context context) {
        super(context);
    }


    public <T extends ZMTimePicker> void showZMTimePicker(Class<T> clazz) {
        ZMTimePicker zmTimePicker = ZMTimePickerFactory.createZMTimePicker(clazz);
        if (zmTimePicker != null) {
            zmTimePicker
                    .getZMTimePicker(mContext, false, false, false)
                    .showTimePicker()
                    .setOnOptionsSelectListener(clazz.getSimpleName(), mZMTimePickerView);
        }
    }


    @Override
    public void attachView(BaseView view) {
        if (view instanceof ZMTimePickerView) {
            mZMTimePickerView = (ZMTimePickerView) view;
        }
    }
}
